//
//  LeftDrawerViewController.m
//  A_GOGO
//
//  Created by Liuiu on 16/1/22.
//  Copyright © 2016年 www.lanou3g.com. All rights reserved.
//

#import "LeftDrawerViewController.h"
#import "UIColor+Wonderful.h"
#import "NetworkHandler.h"
#import "HomeModel.h"
#import <UIImageView+WebCache.h>
#import "MyselfViewController.h"
@interface LeftDrawerViewController ()

@end

@implementation LeftDrawerViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.view.backgroundColor = [UIColor midnightBlue];

    
    [self data];
    
    
}
- (void)data
{
    NSString *str =@"http://open.youxiduo.com/user/info/?debug=beta&source=bc9d9f7784910a6766fadf6a267bf753&appname=yxdjqb&uid=6052381&os=ios&version=3.4.0";
    [NetworkHandler GETWithURL:str completion:^(id result) {
        NSDictionary *dic = [NSDictionary dictionary];
        dic = result[@"result"];
        
        
        HomeModel *c = [[HomeModel alloc]init];
        [c setValuesForKeysWithDictionary:dic];
        
//*************  布局个人页面以及软件信息
        
        
        UIImageView *imagefu =[[UIImageView alloc]initWithFrame:CGRectMake(20, 40, 88, 88)];
        imagefu.backgroundColor = [UIColor whiteColor];
        imagefu.center = CGPointMake(60, 95);
        imagefu.layer.cornerRadius = 88 / 2; //用width / 2 化圆;
        [self.view addSubview:imagefu];
        [imagefu release];
        
//*************  头像
        UIButton *button6 =[UIButton buttonWithType:UIButtonTypeSystem];
        button6.frame = CGRectMake(20, 40, 88, 88);
        button6.backgroundColor = [UIColor clearColor];
        button6.center = CGPointMake(60, 95);
        [button6 addTarget:self action:@selector(tou:) forControlEvents:UIControlEventTouchUpInside];
        [self.view addSubview:button6];
        
        UIImageView *image = [[UIImageView alloc]initWithFrame:CGRectMake(20,50, 80, 80)];
        [image sd_setImageWithURL:[NSURL URLWithString:c.avatar]];
        image.layer.cornerRadius = 80 / 2;
        image.center = CGPointMake(60, 95);
        image.clipsToBounds = YES;
        [self.view addSubview:image];
        [image release];
        
        
        UIImageView *img = [[UIImageView alloc]initWithFrame:CGRectMake(200, 52, 28, 28)];
        [img sd_setImageWithURL:[NSURL URLWithString:c.levelImg]];
        img.layer.cornerRadius = 14;
        [self.view addSubview:img];
        [img release];
        
        UILabel *label = [[UILabel alloc]initWithFrame: CGRectMake(120, 52, 80, 30)];
        label.text = c.nick;
        label.textColor = [UIColor whiteColor];
        label.font = [UIFont fontWithName:@"Helvetica-Bold" size:19];
        [self.view addSubview:label];
        [label release];
        
        UILabel *count =[[UILabel alloc]initWithFrame: CGRectMake(120, 85, 60, 25)];
        count.text = @"游币:";
        count.textColor = [UIColor gainsboroColor];
        [self.view addSubview:count];
        [count release];
        
        UILabel *money =[[UILabel alloc]initWithFrame:CGRectMake(150, 85, 60, 25)];
        money.text = c.money;
        money.textAlignment = NSTextAlignmentCenter;
        money.textColor = [UIColor chocolateColor];
        [self.view addSubview:money];
        [money release];
        
        UILabel *pangbai = [[UILabel alloc]initWithFrame: CGRectMake(120, 110, 200, 25)];
        pangbai.text = @"今天        个未完成任务";
        pangbai.textColor = [UIColor gainsboroColor];
        [self.view addSubview:pangbai];
        [pangbai release];
        
        UILabel *task = [[UILabel alloc]initWithFrame:CGRectMake(165, 110, 15, 25)];
        task.textColor = [UIColor redColor];
        task.text = c.tasknum;
        
        [self.view addSubview:task];
        [task release];
//******** 消息
        UIImageView *img1 =[[UIImageView alloc]initWithFrame:CGRectMake(20, 165, 115, 30)];
        img1.backgroundColor = [UIColor aquamarine];
        img1.layer.cornerRadius = 7;
        [self.view addSubview:img1];
        [img1 release];

        UIImageView *img2 =[[UIImageView alloc]initWithFrame:CGRectMake(175, 165, 115, 30)];
        img2.backgroundColor =[UIColor doderBlue];
        img2.layer.cornerRadius = 7;
        [self.view addSubview:img2];
        [img2 release];
        
        UIImageView *img3 = [[UIImageView alloc]initWithFrame:CGRectMake(20, 5, 25, 20)];
        img3.image = [UIImage imageNamed:@"xin"];
        [img1 addSubview:img3];
        [img3 release];
        
        UILabel *labelxin = [[UILabel alloc]initWithFrame:CGRectMake(55, 5, 60, 20)];
        labelxin.text = @"消息";
        labelxin.textColor = [UIColor whiteColor];
        [img1 addSubview:labelxin];
        [labelxin release];

        UIButton *button7 = [UIButton buttonWithType:UIButtonTypeSystem];
        button7.frame = CGRectMake(20, 165, 115, 30);
        button7.layer.cornerRadius = 7;
        button7.backgroundColor = [UIColor clearColor];
        [button7 addTarget:self action:@selector(xin:) forControlEvents:UIControlEventTouchUpInside];
        [self.view addSubview:button7];
  
        UIImageView *img4 = [[UIImageView alloc]initWithFrame:CGRectMake(20, 5, 25, 20)];
        img4.image = [UIImage imageNamed:@"qian"];
        [img2 addSubview:img4];
        [img4 release];
        
        UILabel *labelqian = [[UILabel alloc]initWithFrame:CGRectMake(55, 5, 60, 20)];
        labelqian.textColor = [UIColor whiteColor];
        labelqian.text = @"签到";
        [img2 addSubview:labelqian];
        [labelqian release];
        
        UILabel *xian =[[UILabel alloc]initWithFrame:CGRectMake(0, 205, self.view.frame.size.width, 1)];
        xian.backgroundColor = [UIColor gainsboroColor];
        xian.alpha = 0.2;
        [self.view addSubview:xian];
        [xian release];
//********  签到
        UIButton *button8 = [UIButton buttonWithType:UIButtonTypeSystem];
        button8.frame = CGRectMake(175, 165, 115, 30);
        button8.backgroundColor = [UIColor clearColor];
        [button8 addTarget:self action:@selector(qian:) forControlEvents:UIControlEventTouchUpInside];
        [self.view addSubview:button8];
//******** 分享好友
        UIImageView *share = [[UIImageView alloc]initWithFrame:CGRectMake(20, 260, 230 / 3, 230 / 3)];
        
        share.image = [UIImage imageNamed:@"fenxiang"];
        [self.view addSubview:share];
        [share release];
        
        UILabel *share2 = [[UILabel alloc]initWithFrame:CGRectMake(20, 260 + 230 / 3, 80, 40)];
        share2.text = @"分享好友";
        share2.textColor = [UIColor whiteColor];
        [self.view addSubview:share2];
        [share2 release];
        
        UIButton *button1 =[UIButton buttonWithType:UIButtonTypeSystem];
        button1.frame =CGRectMake(20, 260, 230 / 3, 230 / 3);
        button1.backgroundColor = [UIColor clearColor];
        [button1 addTarget:self action:@selector(share:) forControlEvents:UIControlEventTouchUpInside];
        [self.view addSubview:button1];
        
//********  给予评价
        UIImageView *ping = [[UIImageView alloc]initWithFrame:CGRectMake(50 + 230 / 3, 260, 230 / 3, 230 / 3)];
        ping.image = [UIImage imageNamed:@"xing"];
        [self.view addSubview:ping];
        [ping release];
        
        UILabel *ping1 = [[UILabel alloc]initWithFrame:CGRectMake(50 + 230/ 3, 260 + 230 / 3, 80, 40)];
        ping1.text = @"给予评价";
        ping1.textColor = [UIColor whiteColor];
        [self.view addSubview:ping1];
        [ping1 release];
        
        UIButton *button2 =[UIButton buttonWithType:UIButtonTypeSystem];
        button2.frame = CGRectMake(50 + 230 / 3, 260, 230 / 3, 230 / 3);
        button2.backgroundColor = [UIColor clearColor];
        [button2 addTarget:self action:@selector(ping:) forControlEvents:UIControlEventTouchUpInside];
        [self.view addSubview:button2];
//********  关于我们
        UIImageView *we= [[UIImageView alloc]initWithFrame:CGRectMake(80 + 230 / 3 * 2, 260, 230 / 3, 230 / 3)];
        we.image = [UIImage imageNamed:@"guanyuwomen"];
        [self.view addSubview:we];
        [we release];
        
        UILabel *wo = [[UILabel alloc]initWithFrame:CGRectMake(80 + 230/ 3 * 2, 260 + 230 / 3, 80, 40)];
        wo.text = @"关于我们";
       wo.textColor = [UIColor whiteColor];
        [self.view addSubview:wo];
        [wo release];
        
        UIButton *button3 =[UIButton buttonWithType:UIButtonTypeSystem];
        button3.frame = CGRectMake(80 + 230 / 3 * 2, 260, 230 / 3, 230 / 3);
        button3.backgroundColor = [UIColor clearColor];
        [button3 addTarget:self action:@selector(wo:) forControlEvents:UIControlEventTouchUpInside];
        [self.view addSubview:button3];
        
// ***********  绑定
        UIImageView *bang= [[UIImageView alloc]initWithFrame:CGRectMake(16, 340 + 230 / 3,230 / 3,230 / 3)];
        bang.image = [UIImage imageNamed:@"chenggongbangding"];
        [self.view addSubview:bang];
        [bang release];
        
        UILabel *bangd = [[UILabel alloc]initWithFrame:CGRectMake(20, 340 + 230 / 1.5, 80, 40)];
        bangd.text = @"应用绑定";
        bangd.textColor = [UIColor whiteColor];
        [self.view addSubview:bangd];
        [bangd release];
        
        UIButton *button4 =[UIButton buttonWithType:UIButtonTypeSystem];
        button4.frame = CGRectMake(20, 340 + 230 / 3,230 / 3,230 / 3);
        button4.backgroundColor = [UIColor clearColor];
        [button4 addTarget:self action:@selector(bang:) forControlEvents:UIControlEventTouchUpInside];
        [self.view addSubview:button4];
        
//***********  清除
        UIImageView *qing= [[UIImageView alloc]initWithFrame:CGRectMake(47 + 230 / 3, 340 + 230 / 3, 230 / 3, 230 / 3)];
        qing.image = [UIImage imageNamed:@"qingchu"];
        [self.view addSubview:qing];
        [qing release];
        
        UILabel *clear = [[UILabel alloc]initWithFrame:CGRectMake(50 + 230/ 3, 340 + 230 / 1.5, 80, 40)];
        clear.text = @"缓存清除";
        clear.textColor = [UIColor whiteColor];
        [self.view addSubview:clear];
        [clear release];
        
        UIButton *button5 =[UIButton buttonWithType:UIButtonTypeSystem];
        button5.frame = CGRectMake(47 + 230 / 3, 340 + 230 / 3, 230 / 3, 230 / 3);
        button5.backgroundColor = [UIColor clearColor];
        [button5 addTarget:self action:@selector(clear:) forControlEvents:UIControlEventTouchUpInside];
        [self.view addSubview:button5];

        UILabel *xian2 = [[UILabel alloc]initWithFrame:CGRectMake(0, 600, self.view.frame.size.width, 1)];
        xian2.backgroundColor = [UIColor gainsboroColor];
        xian2.alpha = 0.1;
        [self.view addSubview:xian2];
        [xian2 release];
        
        UILabel *title = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, 100, 45)];
        title.font = [UIFont fontWithName:@"Helvetica-Bold" size:20];
        title.text = @"GOGO";
        title.textColor = [UIColor snowColor];
        title.textAlignment = NSTextAlignmentCenter;
        title.center = CGPointMake(330 / 2, 625);
        [self.view addSubview:title];
        [title release];
        
        UILabel *edition = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, 40, 15)];
        edition.text = @"1.0";
        edition.textColor = [UIColor snowColor];
        edition.textAlignment = NSTextAlignmentCenter;
        edition.font =[UIFont systemFontOfSize:16];
        edition.center = CGPointMake(330 / 2, 645);
        [self.view addSubview:edition];
        [edition release];
        
    }];
}
#pragma mark - 各实现按钮区
- (void)xin:(UIButton *)btn
{
    NSLog(@"!!来消息");
}
- (void)qian:(UIButton *)btn
{
    NSLog(@"??签到");
}
- (void)tou:(UIButton *)btn
{
    NSLog(@"头像~~");
    MyselfViewController *me =[[MyselfViewController alloc]init];

   

    [self presentViewController:me animated:YES completion:^{
      
       
    }];
    
}
- (void)clear:(UIButton *)btn
{
    NSLog(@"清除");
}
- (void)bang:(UIButton *)btn
{
    NSLog(@"绑定");
}

- (void)wo:(UIButton *)btn
{
    NSLog(@"关于我们");
}

- (void)ping:(UIButton *)btn
{
    NSLog(@"给予评价");
}
- (void)share:(UIButton *)btn
{
    NSLog(@"分享好友");
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
